home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
workbench
/
blankery
/
swazblanker26
/
docs
/
dev
/
exampleblanker.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-01-25
|
4KB
|
145 lines
/*
** $VER: Example 2.6 (25.01.95)
** SwazBlanker Release 2.6
**
** Example SwazBlanker Module Source
**
** (C) Copyright 1992-95 David Swasbrook,
** All Rights Reserved
*/
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/intuition.h>
#include <proto/swazblanker.h>
#include <libraries/swazblanker.h>
struct SwazBlankerBase *SwazBlankerBase;
/*
** Standard version string
*/
extern UBYTE VersionStr[] = "$VER: ExampleBlanker 2.6 (25.01.95)";
extern UBYTE NameStr[] = "ExampleBlanker";
/*
** SwazBlanker ID string
*/
extern UBYTE ID[] = "$BLANKER:"
" CPU=68000"
" KS=39"
" LOAD=None"
" STACK=4096"
" AUTHOR=\"David Swasbrook\""
" EMAIL=\"swaz@iconz.co.nz\""
" TITLE=\"Example Blanker\""
" CYEARS=\"1994\""
"This is an example blanker that is just a simple blank screen."
"\n";
/****** exampleblanker/Prefs() ***********************************
*
* SYNTAX
* Prefs()
*
* FUNCTION
* This is the preferences configuration interface for
* the blanker.
*
* NOTE
* Your user-interface should use the same font as set in
* the SwazBlanker preferences. This can be obtained
* from the SwazBlanker semaphore ssem->InterfaceFont.
* This is pointer to a string, Eg "Helvetica 11".
*
*****************************************************************/
void Prefs(void)
{
struct EasyStruct es = {
sizeof(struct EasyStruct),
0,
"Example Blanker",
"No configuration required",
"Help|Exit" };
struct BlankerPrefsNode *bpn;
APTR SBHelp=NULL;
if( bpn = SB_AddPrefsTaskTagList( &*NameStr, NULL ) )
{
while( EasyRequest(NULL,&es,NULL,NULL) )
{
SBHelp = SB_HelpTags( "Example", NULL,
SBHELP_BlankerPrefs, bpn,
SBHELP_Directory, TRUE,
TAG_DONE);
}
SB_HelpClose( SBHelp );
SB_RemPrefsTask( bpn );
}
}
/****** exampleblanker/Blank() ***********************************
*
* SYNTAX
* Blank()
*
* FUNCTION
* This is the actual blanker routine.
*
*****************************************************************/
void Blank(void)
{
struct Screen *screen;
struct Window *window;
WORD CSpec[] = { 0,0,0,0, -1 };
screen = SB_OpenScreenTags(
SA_DisplayID,0,
SA_Depth,1,
SA_Colors, &CSpec,
TAG_DONE);
if(screen)
{
window = SB_OpenWindowTags(
WA_CustomScreen,screen,
TAG_DONE);
if(window)
{
SB_SetBlankerScreen( screen, window ); /* Set the blankers screen and window */
SB_BlankerReady(); /* Tell SwazBlanker we are working */
Wait(SIGBREAKF_CTRL_C); /* Wait for abort signal */
SB_ClrBlankerScreen( screen, window ); /* Restore old screen */
CloseWindow(window);
}
CloseScreen(screen);
}
}
/****************************************************************
***************************************************************/
void main (int argc, char **argv)
{
LONG arg[] = { 0 , 1 };
APTR argLock, dirLock;
if( SwazBlankerBase = (struct SwazBlankerBase *) OpenLibrary( "swazblanker.library", 41 ) )
{
if (argLock = ReadArgs ("BLANK/S,PREFS/S",&*arg,NULL))
{
dirLock = SB_GotoBlankerHomeDir(); /* Take us to the blanker directory */
if( arg[0] ) Blank(); else Prefs(); /* Do either the BLANK or PREFS option */
SB_ReturnBlankerHomeDir( dirLock ); /* Restore original directory lock */
FreeArgs(argLock);
}
CloseLibrary( (struct Library *) SwazBlankerBase );
}
}